<template>
  <div>
    <van-nav-bar title="黑马优购" fixed>
      <div class="left_arrow" @click="()=>{ $router.go(-1) }" slot="left">
        <van-icon name="arrow-left"/>
        <span>返回</span>
      </div>
    </van-nav-bar>
    <van-button type="info" @click="addressList">+选择收获地址</van-button>
    <img src="../../assets/cart_border@2x.png" alt="">
    <div class="goodsbox" v-for="(item) in $store.state.goBuyGoodsListData" :key="item.id">
      <template>
        <van-card :price="item.price" :title="item.title" :thumb="item.thumb" :num="item.value"></van-card>
      </template>
    </div>
    <div class="login">登录后下单</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      onegoods: ""
    };
  },
  methods: {
    addressList() {
      this.$router.push("/address_list");
    }
    //   //存储cookie数据
    //   setCookie(c_name, value, expireseconds) {
    //     var json = JSON.stringify(value);

    //     var exdate = new Date();
    //     exdate.setTime(exdate.getTime() + expireseconds * 1000);
    //     document.cookie =
    //       c_name +
    //       "=" +
    //       escape(json) +
    //       (expireseconds == null ? "" : ";expires=" + exdate.toGMTString());
    //     // console.log(value);
    //     var json = JSON.stringify(value);
    //     // console.log(json);
    //     this.onegoods = json;
    //     // console.log(this.onegoods);
    //     var ad = JSON.parse(this.onegoods);
    //     console.log(ad);
    //   },
    //   //获取cookie数据
    //   getCookie(as) {
    //     if (document.cookie.length > 0) {
    //       c_start = document.cookie.indexOf(as + "=");
    //       if (c_start != -1) {
    //         c_start = c_start + c_name.length + 1;
    //         c_end = document.cookie.indexOf(";", c_start);
    //         if (c_end == -1) {
    //           c_end = document.cookie.length;
    //         }

    //         return unescape(document.cookie.substring(c_start, c_end));
    //       }
    //     }

    //     return "";
    //   }
  },
  created() {
    // var ad = this.getCookie("as");
    // console.log(ad);
  },
  mounted() {
    // this.setCookie("as", $store.state.goodsListData, 3600);
  }
};
</script>

<style lang="less" scoped>
.van-button {
  display: block;
  height: 35px;
  line-height: 35px;
  margin: 30px auto;
  margin-top: 76px;
}
img {
  width: 100%;
}
.goodsbox {
  display: flex;
  position: relative;
  width: 100%;
  background-color: #fafafa;
  border-bottom: 1px solid red;

  .van-card {
    flex: 1;
    padding-left: 0;
  }
}
.van-nav-bar {
  color: #fff !important;
}
.login {
  position: fixed;
  width: 100%;
  bottom: 0;
  height: 50px;
  background-color: #07c160;
  font-size: 20px;
  text-align: center;
  color: #fff;
  line-height: 50px;
}
</style>